package com.tojabo.swing.seven_listener;

import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

public class ActionListenerDemo2 extends Frame {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	JButton b;

	public ActionListenerDemo2(String str) {
		super(str);
		b = new JButton("确认");
		add(b);
		ActionListener ac = new actionhandlerbu();
		b.addActionListener(ac);
	}

	public static void main(String[] args) {
		ActionListenerDemo2 me = new ActionListenerDemo2("动作事件测试窗口");
		me.pack();
		me.setVisible(true);
	}

	
}
class actionhandlerbu implements ActionListener {
	public void actionPerformed(ActionEvent e) {
		((JButton) e.getSource()).setLabel("取消");
	}
}